//
//  ViewController.m
//  07-UIViewControllerLifeCycle
//
//  Created by dllo on 16/7/22.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "ViewController.h"
#import "FirstViewController.h"

@interface ViewController ()

@end

@implementation ViewController
#pragma mark - life cycle(生命周期)
//  loadView 与 ViewDidLoad 只走一次
- (void)loadView {
    [super loadView];
    NSLog(@"%@ ----- %s",[self class], __FUNCTION__);
}
- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"%@ ----- %s",[self class], __FUNCTION__);
    self.view.backgroundColor = [UIColor cyanColor];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:@selector(barButtonClick:)];
}
// 视图将要出现时, 就会调用
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    NSLog(@"%@ ----- %s",[self class], __FUNCTION__);
}
// 视图完全出现时, 就会调用
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    NSLog(@"%@ ----- %s",[self class], __FUNCTION__);
}
// 视图将要消失, 就会调用, 只要消失一点就调用
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    NSLog(@"%@ ----- %s",[self class], __FUNCTION__);
}
// 视图已经完全消失, 就会调用
- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    NSLog(@"%@ ----- %s",[self class], __FUNCTION__);
}

// 点击方法
- (void)barButtonClick:(UIBarButtonItem *)barButton {
    FirstViewController *first = [[FirstViewController alloc] init];
    [self.navigationController pushViewController:first animated:YES];
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
